<?php

/*
	Class: App_Registry

	About: Author
		J William McCarthy

	About: License
		<http://communit.as/docs/license>

	About: See Also
		Zend_Registry
*/
class App_Registry extends Zend_Registry {

	/* Group: Static Methods */

	/*
		Function: get
			Gets a setting from the registry.

		Arguments:
			setting - The name of the setting.
			default (optional) - The default value of the registry setting, if not found.

		Returns:
			The value of the registry setting.
	*/
	public static function get($setting, $default = null,$module = null) {
	
		if (Zend_Registry::isRegistered($setting)) {
			return Zend_Registry::get($setting);
		} else {			
			$config_table = new Config();
			try {
				$config_table->insert(array('ckey'=>$setting, 'value'=>$default));
			} catch (Exception $ex) {
				// Lazy way of ensuring we don't insert this twice.
			}
			Zend_Registry::set($setting, $default);
			return $default;
		}
	}
}
